import { configureStore } from '@reduxjs/toolkit'
// ThunkAction 用于中间件处理时要的类型推断处理
import type { ThunkAction, Action } from '@reduxjs/toolkit'

import user from '../reducer/user'

const store = configureStore({
  reducer: {
    user
  }
})

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
export type AppThunk<ReturnType = void> = ThunkAction<
  ReturnType,
  RootState,
  unknown,
  Action<string>
>;

export default store
